package utils

import (
	"math/rand"
	"strconv"
	"strings"
	"time"
)

// 随机获取length位的code
func RandomCode(length int) string {
	// 以当前时间为随机数种子
	randBase := rand.New(rand.NewSource(time.Now().UnixNano()))
	var randomList []string
	for i := 0; i < length; i++ {
		intn := randBase.Intn(10)
		randomList = append(randomList, strconv.Itoa(intn))
	}
	return strings.Join(randomList, "")
}
